_gdk_broadway_window_drag_begin (GdkWindow *window,
GdkDevice *device,
GdkContentFormats *formats,
- gint x_root,
- gint y_root)
+ gint dx,
+ gint dy)
{
GdkDragContext *new_context;
GdkDragContext * gdk_drag_begin (GdkWindow *window,
GdkDevice *device,
GdkContentFormats *formats,
- gint x_root,
- gint y_root);
+ gint dx,
+ gint dy);
GDK_AVAILABLE_IN_ALL
gboolean gdk_drag_drop_succeeded (GdkDragContext *context);
* @window: the source window for this drag
* @device: the device that controls this drag
* @formats: (transfer none): the offered formats
- * @x_root: the x coordinate where the drag nominally started
- * @y_root: the y coordinate where the drag nominally started
+ * @dx: the x offset to @device's position where the drag nominally started
+ * @dy: the y offset to @device's position where the drag nominally started
*
* Starts a drag and creates a new drag context for it.
*
_gdk_quartz_window_drag_begin (GdkWindow *window,
GdkDevice *device,
GList *targets,
- gint x_root,
- gint y_root)
+ gint dx,
+ gint dy)
{
g_assert (_gdk_quartz_drag_source_context == NULL);
_gdk_wayland_window_drag_begin (GdkWindow *window,
GdkDevice *device,
GdkContentFormats *formats,
- gint x_root,
- gint y_root)
+ gint dx,
+ gint dy)
{
GdkWaylandDragContext *context_wayland;
GdkDragContext *context;
_gdk_win32_window_drag_begin (GdkWindow *window,
GdkDevice *device,
GdkContentFormats *formats,
- gint x_root,
- gint y_root)
+ gint dx,
+ gint dy)
{
GdkDragContext *new_context;
GdkWin32DragContext *context_win32;
BYTE kbd_state[256];
GdkWin32Selection *sel_win32 = _gdk_win32_selection_get ();
+ int x_root, y_root;
if (!use_ole2_dnd)
{
context_win32 = GDK_WIN32_DRAG_CONTEXT (new_context);
}
+ gdk_device_get_position (device, &x_root, &y_root);
+ x_root += dx;
+ y_root += dy;
+
context_win32->start_x = x_root;
context_win32->start_y = y_root;
context_win32->last_x = context_win32->start_x;
_gdk_x11_window_drag_begin (GdkWindow *window,
GdkDevice *device,
GdkContentFormats *formats,
- gint x_root,
- gint y_root)
+ gint dx,
+ gint dy)
{
GdkDragContext *context;
+ int x_root, y_root;
context = (GdkDragContext *) g_object_new (GDK_TYPE_X11_DRAG_CONTEXT,
"display", gdk_window_get_display (window),
context->actions = 0;
gdk_drag_context_set_device (context, device);
+ gdk_device_get_position (device, &x_root, &y_root);
+ x_root += dx;
+ y_root += dy;
GDK_X11_DRAG_CONTEXT (context)->start_x = x_root;
GDK_X11_DRAG_CONTEXT (context)->start_y = y_root;
GtkWidget *ipc_widget;
GdkDevice *pointer, *keyboard;
GdkWindow *ipc_window;
- int start_x, start_y;
+ int dx, dy;
GdkAtom selection;
pointer = keyboard = NULL;
GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
gtk_widget_translate_coordinates (widget, toplevel,
x, y, &x, &y);
- gdk_window_get_root_coords (gtk_widget_get_window (toplevel),
- x, y, &start_x, &start_y);
+ gdk_window_get_device_position (gtk_widget_get_window (toplevel),
+ pointer,
+ &dx, &dy,
+ NULL);
+ dx -= x;
+ dy -= y;
}
else if (event && gdk_event_get_event_type (event) == GDK_MOTION_NOTIFY)
{
- double x, y;
+ double ex, ey;
+ GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
- gdk_event_get_root_coords (event, &x, &y);
- start_x = (int)x;
- start_y = (int)y;
+ gdk_event_get_coords (event, &ex, &ey);
+ x = ex;
+ y = ey;
+ gtk_widget_translate_coordinates (widget, toplevel,
+ x, y, &x, &y);
+ gdk_window_get_device_position (gtk_widget_get_window (toplevel),
+ pointer,
+ &dx, &dy,
+ NULL);
+ dx -= x;
+ dy -= y;
}
else
- gdk_device_get_position (pointer, &start_x, &start_y);
+ {
+ dx = 0;
+ dy = 0;
+ }
- context = gdk_drag_begin (ipc_window, pointer, target_list, start_x, start_y);
+ context = gdk_drag_begin (ipc_window, pointer, target_list, dx, dy);
if (!gdk_drag_context_manage_dnd (context, ipc_window, actions))
{